#include "TcpServer.hpp"
#include "Command.hpp"
#include <functional>
#include <memory>

int main(int argc, char *argv[])
{
    if (argc != 2)
    {
        perror("parameter error");
        exit(-1);
    }

    uint16_t port = std::stoi(argv[1]);
    Command command;

    // std::unique_ptr<TcpServer> tsver = std::make_unique<TcpServer>(std::bind(&Command::Service, &command, std::placeholders::_1, std::placeholders::_2), port);
    std::unique_ptr<TcpServer> tsver = std::make_unique<TcpServer>([&command](int a, InetAddr b){
        command.Service(a, b);
    }, port);
    tsver->Init();
    tsver->Loop();

    return 0;
}
